<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 构造函数 特殊函数 通过运行函数 可以获取一个对象
        //优点：直观 缺点：冗余

        function Star() {
            this.name = 'xxx';
            this.age = 17
        }
        var xxx = new Star()
        console.log(xxx);



        function Star1(name,age) {
            this.name = name;
            this.age = age
        }
        var xxx1 = new Star1('lll',18)
        console.log(xxx1);

        var ddd = new Star1('wwll',50)
        console.log(ddd);
    </script>
</body>

</html>